package org.jsets.fastboot.security.config;

import org.jsets.fastboot.security.authc.IAuthcExceptionHandler;
import org.jsets.fastboot.security.filter.TokenAuthcFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;

public class Constants {
	
	public static final String PREFIX = "security";
	public static final String DEFAULT_AUTHC_TYPE = "_DEFAULT_";
	public static final String SPRING_CACHE_TYPE = "spring.cache.type";
	public static final String SPRING_REDIS_HOST = "spring.redis.host";
	public static final String CACHE_TYPE_REDIS = "redis";
	
	public static final int CORS_FILTER_ORDER = FilterRegistrationBean.HIGHEST_PRECEDENCE;
	public static final int TOKEN_AUTHC_FILTER_ORDER = FilterRegistrationBean.LOWEST_PRECEDENCE - 20;
	public static final int TOKEN_AUTHZ_FILTER_ORDER = FilterRegistrationBean.LOWEST_PRECEDENCE-10;
	
	//#################提示信息#################
	public static final String UNAUTHORIZED_TIPS = "未认证";
	public static final String USERNAME_BLANK_TIPS = "账号不能为空";
	public static final String PASSWD_BLANK_TIPS = "密码不能为空";
	public static final String CAPTCHA_KEY_BLANK_TIPS = "验证码Key不能为空";
	public static final String CAPTCHA_BLANK_TIPS = "验证码不能为空";
	public static final String CAPTCHA_INVALID_TIPS = "验证码无效";
	public static final String CAPTCHA_TIMEOUT_TIPS = "验证码过期";
	public static final String USERNAME_OR_PASSWD_ERROR_TIPS = "账号或密码错误";
	public static final String TOKEN_BLANK_TIPS = "令牌不能为空";
	public static final String TOKEN_EXPIRED_TIPS = "令牌过期";
	public static final String TOKEN_INVALID_TIPS = "令牌无效";
	public static final String HMAC_INVALID_TIPS = "HMAC签名验证失败";
	public static final String LOGIN_SUCCEED_TIPS = "登陆成功";
	public static final String LOGIN_ERROR_TIPS = "登陆失败";
	public static final String LOGOUT_SUCCEED_TIPS = "登出成功";
	public static final String FORBIDDEN_TIPS = "权限不足";
	public static final String ONLINE_USER_EXTRUDE_TIPS = "此账号在别处登录，您已经被强制下线";
	public static final String USERNAME_LOCKED_TIPS = "账号被锁定，请联管理员";
	public static final String ACCESS_DENIED_TIPS = "没有权限访问当前地址";
	
	
	
	// 永不过期
	public static final Long EXPIRE_NEVER = -1l;
	// 会话缓存名称
	public static final String TOKEN_CACHE_NAME = "fastboot-token";
	// 在线用户缓存名称
	public static final String USER_ONLINE_CACHE_NAME = "fastboot-online";
	// 默认会话有效期：30分钟=1800秒(s)
	public static final Long TOKEN_EXPIRATION = 1800L;
	// 默认记住我时间：7天=604800秒(s)
	public static final Integer REMEMBER_ME_TIMEOUT = 604800;
	// 验证码缓存名称
	public static final String CAPTCHA_CACHE_NAME = "fastboot-captcha";
	// 密码重试记录缓存名称
	public static final String PASSWD_RETRY_TIMES_CACHE_NAME = "fastboot-passwd-retry";
	// 作废的刷新令牌使缓存名称
	public static final String INVALID_REFRESH_TOKEN_CACHE_NAME = "fastboot-invalid-refresh-token";
	// 作废的刷新令牌使缓存时间，默认30天
	public static final long INVALID_REFRESH_TOKEN_CACHE_TIMEOUT = 30 * 86400l;
	// 密码重试记录缓存时间，默认1天 86400 秒
	public static final long PASSWD_RETRY_TIMES_CACHE_TIMEOUT = 86400l;
	// 验证码缓存时间，默认60 秒
	public static final long CAPTCHA_CACHE_TIMEOUT = 60l;
	// HMAC签名有效期，默认60 秒
	public static final long HMAC_SIGN_TIMEOUT = 60l;

	// 密码编码算法
	public static final String PASSWORD_ENCODE_ALGORITHM_SM3 = "sm3";
	public static final String PASSWORD_ENCODE_ALGORITHM_MD5 = "md5";
	public static final String PASSWORD_ENCODE_ALGORITHM_SHA256 = "sha256";

	
}
